﻿<UserControl x:Class="XamlingCore.SL.Controls.Loaders.DefaultLoaderControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:controls="clr-namespace:XamlingCore.SL.Controls.Content" xmlns:Loaders="clr-namespace:XamlingCore.SL.Controls.Loaders" mc:Ignorable="d"
    d:DesignHeight="300" d:DesignWidth="400">
    
    <UserControl.Resources>
        <Style x:Key="LoadContentControlTemplate" TargetType="controls:TransitionContentControl">
            <Setter Property="Foreground" Value="#FF000000"/>
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
            <Setter Property="VerticalContentAlignment" Value="Top"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="controls:TransitionContentControl">
                        <Grid x:Name="grid">
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="ContentStates">
                                    <VisualStateGroup.Transitions>
                                        <VisualTransition GeneratedDuration="0:0:0.3"/>
                                    </VisualStateGroup.Transitions>
                                    <VisualState x:Name="NormalReverse"/>
                                    <VisualState x:Name="BeforeTransition"/>
                                    <VisualState x:Name="Normal"/>
                                    <VisualState x:Name="BeforeTransitionReverse"/>
                                    <VisualState x:Name="NoContent">
                                        <Storyboard>
                                            <DoubleAnimation Duration="0" To="0" Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="grid" />
                                            <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="grid">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <DiscreteObjectKeyFrame.Value>
                                                        <Visibility>Collapsed</Visibility>
                                                    </DiscreteObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                            <ContentPresenter Cursor="{TemplateBinding Cursor}" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Margin="{TemplateBinding Padding}"/>
                        </Grid>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    
    <Grid x:Name="LayoutRoot">
        <controls:XTransitionContentControl Content="{Binding IsLoading}" Style="{StaticResource LoadContentControlTemplate}" Grid.RowSpan="2" Grid.Row="1" Margin="0,0,1,0">
            <controls:XTransitionContentControl.ContentTemplate>
                <DataTemplate>
                    <Grid Background="#69000000">
                        <Border Background="Black" CornerRadius="10" Width="159" Height="78">
                            <Loaders:Loader/>
                        </Border>
                    </Grid>
                </DataTemplate>
            </controls:XTransitionContentControl.ContentTemplate>
        </controls:XTransitionContentControl>
    </Grid>
</UserControl>
